import Vue from 'vue'
import Router from 'vue-router'
import HomePage from '@/components/page/HomePage'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import  PhoneLists from '@/components/page/PhoneLists'
import VueLazyload from 'vue-lazyload'

Vue.use(Router)
Vue.use(ElementUI)
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: '../../src/assets/error_images.png',//这个是请求失败后显示的图片
  loading: '../../src/assets/loading_icon.gif',//这个是加载的loading过渡效果
  attempt: 1
})


export default new Router({
  // mode:'history',
  routes: [
    {
      path: '/',
      name: '主页',
      component: HomePage
    },
    {
      path: '/phoneLists',
      name: '详情页面',
      component: PhoneLists
    },
  ],
  scrollBehavior(to, from,savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
})
